class Solution
{
public:
    int minimumPushes(string word)
    {
        vector<int> charCount(26, 0);
        for (char c : word)
        {
            charCount[c - 'a']++;
        }
        sort(charCount.begin(), charCount.end(), greater<int>());
        int result = 0;
        int k = 0;
        for (int count : charCount)
        {
            if (count == 0)
            {
                break;
            }
            result += count * (k / 8 + 1);
            k++;
        }
        return result;
    }
};